import { Component, OnInit, Input, OnChanges, OnDestroy } from '@angular/core';

import { DashboradHistoryService } from './dashborad.history.service';

import { Util } from '../../../../utils/util';

import { Scope } from '../../../../utils/emit';

import { AppSettings } from '../../../../app.settings';

@Component({
  selector: 'dashborad-history',
  templateUrl: './dashborad.history.html',
  providers: [DashboradHistoryService]
})
export class DashboradHistory implements OnInit {

  @Input('date') date: any;

  vm = {
    "loading": true,
    "data": [],
    "column": {
      "fileName": '',
      "dim": ['date', 'categoryId', 'sellMoney', 'sellAmount', 'monthSellMoney', 'monthSellAmount', 'productNum', 'shopNum', 'tsellMoney', 'tsellAmount', 'monthTSellMoney', 'monthTSellAmount', 'tproductNum', 'tshopNum', 'thksellMoney', 'thksellAmount', 'monthThkSellMoney', 'monthThkSellAmount', 'thkproductNum', 'thkshopNum', 'gsellMoney', 'gsellAmount', 'monthGSellMoney', 'monthGSellAmount', 'gproductNum', 'gshopNum', 'csellMoney', 'csellAmount', 'monthCSellMoney', 'monthCSellAmount', 'cproductNum', 'cshopNum'],
      "dimText": ['时间', '类目id', '日销售额', '日销售量', '近30天销售额', '近30天销售量', '动销宝贝数', '动销店铺数', '天猫日销售额', '天猫日销售量', '天猫近30天销售额', '天猫近30天销售量', '天猫动销宝贝数', '天猫动销店铺数', '天猫国际日销售额', '天猫国际日销售量', '天猫国际近30天销售额', '天猫国际近30天销售量', '天猫国际动销宝贝数', '天猫国际动销店铺数', '全球购日销售额', '全球购日销售量', '全球购近30天销售额', '全球购近30天销售量', '全球购动销宝贝数', '全球购动销店铺数', '淘宝日销售额', '淘宝日销售量', '淘宝近30天销售额', '淘宝近30天销售量', '淘宝动销宝贝数', '淘宝动销店铺数']
    },
    "type": 'line-m',
    "fileName": '',
    "click": (params) => {
      console.log(params);
    }
  };

  columns = ['时间', '日销售量', '日销售额', '近30天销售量', '近30天销售额', '动销店铺数', '动销宝贝数'];

  // 类目 接收pie component cat change
  cat: any = {
    catName: "",
    wholeName: "",
    categoryId: ""
  };

  constructor(private _service: DashboradHistoryService, private util: Util, private scope: Scope, private appSettings: AppSettings) {

  }


  sellEvent: any;
  ngOnInit() {

    // 如果不是第一次进入
    this.cat = this.appSettings.getAppCat();

    this.sellEvent = this.scope.on('dashborad-all-cur-cat', (data) => {

      console.log("dash sell");
      console.log(data);

      this.cat = data.data;
      this.vm.loading = true;

      if (!this.date) {

        setTimeout(() => {
          this.getHttp(this.cat, this.date.date);
        }, 500);

        return;
      }
      this.getHttp(this.cat, this.date.date);

    });
  }



  // change

  ngOnChanges(changes) {

    console.log(changes);

    // 日期
    if (changes.date && changes.date.currentValue && changes.date.currentValue.timeType == 'day') {

      console.log(this.date);

      if (this.cat.categoryId == "") {
        return;
      }

      // this.getHttp(this.cat,this.date.date);
      this.vm.loading = true;

      this.getHttp(this.cat, this.date.date);


    }



  }

  ngOnDestroy() {
    if (this.offEvent) {
      this.offEvent.unsubscribe();
    }

    if (this.sellEvent) {
      this.sellEvent.unsubscribe();
    }

  }

  export() {
    console.log("export");

    let data = this.util.jsonToArrry(this.vm.data, this.vm.column.dim, this.vm.column.dimText);


    this.util.export(data, this.vm.column.fileName);
  }


  sellResulet: any = {
    sellMoney: 0,
    sellAmount: 0
  };
  offEvent: any;
  getHttp(param, date) {

    // console.log(param);

    // console.log(date);


    this.vm.column.fileName = param.catName + "类目销售额走势";

    this.sellResulet = {
      sellMoney: 0,
      sellAmount: 0
    };

    var res = {
      "code": 0, "msg": "成功", "data": [
        { "id": "50019780\u00012017-11-06 00:00:00\u0001", "date": "2017-11-06 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 8472, "tsellAmount": 6650, "csellAmount": 1778, "thksellAmount": 0, "gsellAmount": 44, "monthSellAmount": 204203, "monthTSellAmount": 148752, "monthCSellAmount": 54672, "monthThkSellAmount": 49, "monthGSellAmount": 730, "sellMoney": 9706169.98, "tsellMoney": 6248499.0, "csellMoney": 3354314.92, "thksellMoney": 0.0, "gsellMoney": 103356.06, "monthSellMoney": 2.9401404587E8, "monthTSellMoney": 1.8504929901E8, "monthCSellMoney": 1.0736547878E8, "monthThkSellMoney": 16611.0, "monthGSellMoney": 1582657.08, "productNum": 3379, "tproductNum": 1211, "cproductNum": 2137, "thkproductNum": 1, "gproductNum": 30, "shopNum": 766, "tshopNum": 188, "cshopNum": 567, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-07 00:00:00\u0001", "date": "2017-11-07 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5049, "tsellAmount": 3761, "csellAmount": 1245, "thksellAmount": 0, "gsellAmount": 43, "monthSellAmount": 153265, "monthTSellAmount": 116308, "monthCSellAmount": 36204, "monthThkSellAmount": 0, "monthGSellAmount": 753, "sellMoney": 6507757.42, "tsellMoney": 4096633.0, "csellMoney": 2310300.51, "thksellMoney": 0.0, "gsellMoney": 100823.91, "monthSellMoney": 2.2059169988E8, "monthTSellMoney": 1.47559856E8, "monthCSellMoney": 7.139862477E7, "monthThkSellMoney": 0.0, "monthGSellMoney": 1633219.11, "productNum": 2649, "tproductNum": 929, "cproductNum": 1690, "thkproductNum": 0, "gproductNum": 30, "shopNum": 672, "tshopNum": 160, "cshopNum": 502, "thkshopNum": 0, "gshopNum": 10 }, { "id": "50019780\u00012017-11-08 00:00:00\u0001", "date": "2017-11-08 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 1626, "tsellAmount": 721, "csellAmount": 842, "thksellAmount": 0, "gsellAmount": 63, "monthSellAmount": 22064, "monthTSellAmount": 9392, "monthCSellAmount": 12251, "monthThkSellAmount": 0, "monthGSellAmount": 421, "sellMoney": 3403833.93, "tsellMoney": 1640166.0, "csellMoney": 1599610.93, "thksellMoney": 0.0, "gsellMoney": 164057.0, "monthSellMoney": 5.17455893E7, "monthTSellMoney": 2.200602516E7, "monthCSellMoney": 2.852753514E7, "monthThkSellMoney": 0.0, "monthGSellMoney": 1212029.0, "productNum": 1354, "tproductNum": 268, "cproductNum": 1063, "thkproductNum": 0, "gproductNum": 23, "shopNum": 500, "tshopNum": 94, "cshopNum": 398, "thkshopNum": 0, "gshopNum": 8 }, { "id": "50019780\u00012017-11-09 00:00:00\u0001", "date": "2017-11-09 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 7495, "tsellAmount": 5058, "csellAmount": 2335, "thksellAmount": 0, "gsellAmount": 102, "monthSellAmount": 173143, "monthTSellAmount": 124837, "monthCSellAmount": 47409, "monthThkSellAmount": 48, "monthGSellAmount": 849, "sellMoney": 3563934.54, "tsellMoney": 1726930.0, "csellMoney": 1631638.54, "thksellMoney": 0.0, "gsellMoney": 205366.0, "monthSellMoney": 5.454977481E7, "monthTSellMoney": 2.383465415E7, "monthCSellMoney": 2.921848166E7, "monthThkSellMoney": 0.0, "monthGSellMoney": 1496639.0, "productNum": 3246, "tproductNum": 1169, "cproductNum": 2046, "thkproductNum": 1, "gproductNum": 30, "shopNum": 749, "tshopNum": 185, "cshopNum": 553, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-10 00:00:00\u0001", "date": "2017-11-10 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 7126, "tsellAmount": 3372, "csellAmount": 3661, "thksellAmount": 0, "gsellAmount": 93, "monthSellAmount": 247046, "monthTSellAmount": 191198, "monthCSellAmount": 54703, "monthThkSellAmount": 67, "monthGSellAmount": 1078, "sellMoney": 1.218513743E7, "tsellMoney": 3235036.99, "csellMoney": 8691013.29, "thksellMoney": 0.0, "gsellMoney": 259087.15, "monthSellMoney": 4.0366419841E8, "monthTSellMoney": 2.9429173777E8, "monthCSellMoney": 1.0629668114E8, "monthThkSellMoney": 22713.0, "monthGSellMoney": 3053066.5, "productNum": 3297, "tproductNum": 1174, "cproductNum": 2094, "thkproductNum": 1, "gproductNum": 28, "shopNum": 752, "tshopNum": 185, "cshopNum": 556, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-11 00:00:00\u0001", "date": "2017-11-11 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 104185, "tsellAmount": 99111, "csellAmount": 4863, "thksellAmount": 0, "gsellAmount": 211, "monthSellAmount": 253281, "monthTSellAmount": 197691, "monthCSellAmount": 54445, "monthThkSellAmount": 67, "monthGSellAmount": 1078, "sellMoney": 1.9994499462E8, "tsellMoney": 1.8787261291E8, "csellMoney": 1.158879135E7, "thksellMoney": 0.0, "gsellMoney": 483590.36, "monthSellMoney": 4.1840342341E8, "monthTSellMoney": 3.0923227177E8, "monthCSellMoney": 1.0609537214E8, "monthThkSellMoney": 22713.0, "monthGSellMoney": 3053066.5, "productNum": 3272, "tproductNum": 1167, "cproductNum": 2076, "thkproductNum": 1, "gproductNum": 28, "shopNum": 752, "tshopNum": 185, "cshopNum": 556, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-12 00:00:00\u0001", "date": "2017-11-12 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 36866, "tsellAmount": 28519, "csellAmount": 8049, "thksellAmount": 35, "gsellAmount": 263, "monthSellAmount": 253138, "monthTSellAmount": 197630, "monthCSellAmount": 54359, "monthThkSellAmount": 67, "monthGSellAmount": 1082, "sellMoney": 6.258669717E7, "tsellMoney": 4.515230374E7, "csellMoney": 1.665250467E7, "thksellMoney": 11865.0, "gsellMoney": 770023.76, "monthSellMoney": 4.1823442341E8, "monthTSellMoney": 3.0917948177E8, "monthCSellMoney": 1.0596978014E8, "monthThkSellMoney": 22713.0, "monthGSellMoney": 3062448.5, "productNum": 3263, "tproductNum": 1161, "cproductNum": 2071, "thkproductNum": 1, "gproductNum": 30, "shopNum": 749, "tshopNum": 185, "cshopNum": 553, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-13 00:00:00\u0001", "date": "2017-11-13 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 6480, "tsellAmount": 4369, "csellAmount": 2048, "thksellAmount": 0, "gsellAmount": 63, "monthSellAmount": 245364, "monthTSellAmount": 197767, "monthCSellAmount": 46541, "monthThkSellAmount": 38, "monthGSellAmount": 1018, "sellMoney": 8856718.66, "tsellMoney": 4745237.05, "csellMoney": 3934353.4, "thksellMoney": 0.0, "gsellMoney": 177128.21, "monthSellMoney": 4.1094410918E8, "monthTSellMoney": 3.0770065288E8, "monthCSellMoney": 1.0038987677E8, "monthThkSellMoney": 29640.0, "monthGSellMoney": 2823939.53, "productNum": 3134, "tproductNum": 1152, "cproductNum": 1952, "thkproductNum": 1, "gproductNum": 29, "shopNum": 731, "tshopNum": 184, "cshopNum": 536, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-14 00:00:00\u0001", "date": "2017-11-14 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5755, "tsellAmount": 3743, "csellAmount": 1939, "thksellAmount": 0, "gsellAmount": 73, "monthSellAmount": 245600, "monthTSellAmount": 198162, "monthCSellAmount": 46325, "monthThkSellAmount": 38, "monthGSellAmount": 1075, "sellMoney": 7418998.01, "tsellMoney": 3560319.01, "csellMoney": 3642869.0, "thksellMoney": 0.0, "gsellMoney": 215810.0, "monthSellMoney": 4.1044651209E8, "monthTSellMoney": 3.0765870687E8, "monthCSellMoney": 9.983376149E7, "monthThkSellMoney": 13984.0, "monthGSellMoney": 2940059.73, "productNum": 3107, "tproductNum": 1139, "cproductNum": 1938, "thkproductNum": 1, "gproductNum": 29, "shopNum": 728, "tshopNum": 183, "cshopNum": 534, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-15 00:00:00\u0001", "date": "2017-11-15 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 6039, "tsellAmount": 4113, "csellAmount": 1882, "thksellAmount": 0, "gsellAmount": 44, "monthSellAmount": 245153, "monthTSellAmount": 198752, "monthCSellAmount": 45265, "monthThkSellAmount": 38, "monthGSellAmount": 1098, "sellMoney": 7962561.9, "tsellMoney": 4133584.99, "csellMoney": 3712167.78, "thksellMoney": 0.0, "gsellMoney": 116809.13, "monthSellMoney": 4.0987525511E8, "monthTSellMoney": 3.0792558788E8, "monthCSellMoney": 9.896257062E7, "monthThkSellMoney": 13984.0, "monthGSellMoney": 2973112.61, "productNum": 3078, "tproductNum": 1131, "cproductNum": 1917, "thkproductNum": 1, "gproductNum": 29, "shopNum": 720, "tshopNum": 182, "cshopNum": 527, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-16 00:00:00\u0001", "date": "2017-11-16 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5757, "tsellAmount": 3929, "csellAmount": 1753, "thksellAmount": 1, "gsellAmount": 74, "monthSellAmount": 245603, "monthTSellAmount": 199545, "monthCSellAmount": 44869, "monthThkSellAmount": 38, "monthGSellAmount": 1151, "sellMoney": 7573506.9, "tsellMoney": 3951342.0, "csellMoney": 3443411.83, "thksellMoney": 339.0, "gsellMoney": 178414.07, "monthSellMoney": 4.0992684574E8, "monthTSellMoney": 3.0836578976E8, "monthCSellMoney": 9.845059737E7, "monthThkSellMoney": 12882.0, "monthGSellMoney": 3097576.61, "productNum": 3057, "tproductNum": 1131, "cproductNum": 1896, "thkproductNum": 1, "gproductNum": 29, "shopNum": 716, "tshopNum": 181, "cshopNum": 524, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-17 00:00:00\u0001", "date": "2017-11-17 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5502, "tsellAmount": 3773, "csellAmount": 1655, "thksellAmount": 3, "gsellAmount": 71, "monthSellAmount": 246243, "monthTSellAmount": 200095, "monthCSellAmount": 44905, "monthThkSellAmount": 40, "monthGSellAmount": 1203, "sellMoney": 7465655.76, "tsellMoney": 3728350.99, "csellMoney": 3557216.77, "thksellMoney": 1017.0, "gsellMoney": 179071.0, "monthSellMoney": 4.1024934604E8, "monthTSellMoney": 3.0853632074E8, "monthCSellMoney": 9.848755576E7, "monthThkSellMoney": 13560.0, "monthGSellMoney": 3211909.54, "productNum": 3058, "tproductNum": 1127, "cproductNum": 1902, "thkproductNum": 1, "gproductNum": 28, "shopNum": 718, "tshopNum": 180, "cshopNum": 527, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-18 00:00:00\u0001", "date": "2017-11-18 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5383, "tsellAmount": 3830, "csellAmount": 1482, "thksellAmount": 4, "gsellAmount": 67, "monthSellAmount": 246975, "monthTSellAmount": 200816, "monthCSellAmount": 44859, "monthThkSellAmount": 34, "monthGSellAmount": 1266, "sellMoney": 7433938.17, "tsellMoney": 4116437.97, "csellMoney": 3148943.81, "thksellMoney": 1472.0, "gsellMoney": 167084.39, "monthSellMoney": 4.1072142916E8, "monthTSellMoney": 3.0891833374E8, "monthCSellMoney": 9.838375869E7, "monthThkSellMoney": 12512.0, "monthGSellMoney": 3406824.73, "productNum": 3045, "tproductNum": 1117, "cproductNum": 1901, "thkproductNum": 1, "gproductNum": 26, "shopNum": 716, "tshopNum": 180, "cshopNum": 525, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-19 00:00:00\u0001", "date": "2017-11-19 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5030, "tsellAmount": 3565, "csellAmount": 1391, "thksellAmount": 2, "gsellAmount": 72, "monthSellAmount": 247363, "monthTSellAmount": 201300, "monthCSellAmount": 44720, "monthThkSellAmount": 30, "monthGSellAmount": 1313, "sellMoney": 7131891.86, "tsellMoney": 3797437.99, "csellMoney": 3136718.57, "thksellMoney": 736.0, "gsellMoney": 196999.3, "monthSellMoney": 4.105569611E8, "monthTSellMoney": 3.0901308474E8, "monthCSellMoney": 9.800745076E7, "monthThkSellMoney": 11040.0, "monthGSellMoney": 3525385.6, "productNum": 3040, "tproductNum": 1113, "cproductNum": 1900, "thkproductNum": 1, "gproductNum": 26, "shopNum": 717, "tshopNum": 181, "cshopNum": 525, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-20 00:00:00\u0001", "date": "2017-11-20 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5535, "tsellAmount": 3855, "csellAmount": 1593, "thksellAmount": 0, "gsellAmount": 87, "monthSellAmount": 247423, "monthTSellAmount": 201994, "monthCSellAmount": 44081, "monthThkSellAmount": 26, "monthGSellAmount": 1322, "sellMoney": 7877017.82, "tsellMoney": 4157481.02, "csellMoney": 3508904.73, "thksellMoney": 0.0, "gsellMoney": 210632.07, "monthSellMoney": 4.1024002926E8, "monthTSellMoney": 3.0931071075E8, "monthCSellMoney": 9.736293871E7, "monthThkSellMoney": 9568.0, "monthGSellMoney": 3556811.8, "productNum": 3027, "tproductNum": 1112, "cproductNum": 1888, "thkproductNum": 1, "gproductNum": 26, "shopNum": 714, "tshopNum": 181, "cshopNum": 522, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-21 00:00:00\u0001", "date": "2017-11-21 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5303, "tsellAmount": 3515, "csellAmount": 1704, "thksellAmount": 0, "gsellAmount": 84, "monthSellAmount": 248388, "monthTSellAmount": 202718, "monthCSellAmount": 44197, "monthThkSellAmount": 26, "monthGSellAmount": 1447, "sellMoney": 7520704.13, "tsellMoney": 3852663.99, "csellMoney": 3467994.14, "thksellMoney": 0.0, "gsellMoney": 200046.0, "monthSellMoney": 4.1084879734E8, "monthTSellMoney": 3.0963062074E8, "monthCSellMoney": 9.737637079E7, "monthThkSellMoney": 9568.0, "monthGSellMoney": 3832237.81, "productNum": 3020, "tproductNum": 1110, "cproductNum": 1883, "thkproductNum": 1, "gproductNum": 26, "shopNum": 715, "tshopNum": 182, "cshopNum": 522, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-22 00:00:00\u0001", "date": "2017-11-22 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5715, "tsellAmount": 4058, "csellAmount": 1583, "thksellAmount": 0, "gsellAmount": 74, "monthSellAmount": 248729, "monthTSellAmount": 203375, "monthCSellAmount": 43832, "monthThkSellAmount": 25, "monthGSellAmount": 1497, "sellMoney": 8435281.69, "tsellMoney": 4835074.0, "csellMoney": 3400797.62, "thksellMoney": 0.0, "gsellMoney": 199410.07, "monthSellMoney": 4.1078119655E8, "monthTSellMoney": 3.0988604475E8, "monthCSellMoney": 9.692438206E7, "monthThkSellMoney": 9200.0, "monthGSellMoney": 3961569.74, "productNum": 3007, "tproductNum": 1097, "cproductNum": 1882, "thkproductNum": 1, "gproductNum": 27, "shopNum": 711, "tshopNum": 181, "cshopNum": 519, "thkshopNum": 1, "gshopNum": 10 }, { "id": "50019780\u00012017-11-23 00:00:00\u0001", "date": "2017-11-23 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5550, "tsellAmount": 3830, "csellAmount": 1627, "thksellAmount": 0, "gsellAmount": 93, "monthSellAmount": 247859, "monthTSellAmount": 203527, "monthCSellAmount": 42802, "monthThkSellAmount": 25, "monthGSellAmount": 1505, "sellMoney": 7820106.99, "tsellMoney": 4432087.0, "csellMoney": 3159107.92, "thksellMoney": 0.0, "gsellMoney": 228912.07, "monthSellMoney": 4.1057837701E8, "monthTSellMoney": 3.1047987976E8, "monthCSellMoney": 9.610753344E7, "monthThkSellMoney": 8475.0, "monthGSellMoney": 3982488.81, "productNum": 3042, "tproductNum": 1114, "cproductNum": 1898, "thkproductNum": 1, "gproductNum": 29, "shopNum": 718, "tshopNum": 180, "cshopNum": 526, "thkshopNum": 1, "gshopNum": 11 }, { "id": "50019780\u00012017-11-24 00:00:00\u0001", "date": "2017-11-24 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5742, "tsellAmount": 3640, "csellAmount": 2032, "thksellAmount": 0, "gsellAmount": 70, "monthSellAmount": 247927, "monthTSellAmount": 203813, "monthCSellAmount": 42527, "monthThkSellAmount": 25, "monthGSellAmount": 1562, "sellMoney": 8253525.93, "tsellMoney": 4277534.99, "csellMoney": 3805316.8, "thksellMoney": 0.0, "gsellMoney": 170674.14, "monthSellMoney": 4.1042206462E8, "monthTSellMoney": 3.1067264875E8, "monthCSellMoney": 9.559905706E7, "monthThkSellMoney": 8475.0, "monthGSellMoney": 4141883.81, "productNum": 3065, "tproductNum": 1122, "cproductNum": 1912, "thkproductNum": 1, "gproductNum": 30, "shopNum": 720, "tshopNum": 180, "cshopNum": 528, "thkshopNum": 1, "gshopNum": 11 }, { "id": "50019780\u00012017-11-25 00:00:00\u0001", "date": "2017-11-25 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5347, "tsellAmount": 3709, "csellAmount": 1570, "thksellAmount": 1, "gsellAmount": 67, "monthSellAmount": 248632, "monthTSellAmount": 204800, "monthCSellAmount": 42151, "monthThkSellAmount": 25, "monthGSellAmount": 1656, "sellMoney": 7401027.61, "tsellMoney": 4188419.98, "csellMoney": 3043150.63, "thksellMoney": 339.0, "gsellMoney": 169118.0, "monthSellMoney": 4.0950310491E8, "monthTSellMoney": 3.1113786973E8, "monthCSellMoney": 9.398893237E7, "monthThkSellMoney": 8475.0, "monthGSellMoney": 4367827.81, "productNum": 3069, "tproductNum": 1115, "cproductNum": 1923, "thkproductNum": 1, "gproductNum": 30, "shopNum": 725, "tshopNum": 180, "cshopNum": 533, "thkshopNum": 1, "gshopNum": 11 }, { "id": "50019780\u00012017-11-26 00:00:00\u0001", "date": "2017-11-26 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 6335, "tsellAmount": 4686, "csellAmount": 1558, "thksellAmount": 1, "gsellAmount": 90, "monthSellAmount": 249334, "monthTSellAmount": 205444, "monthCSellAmount": 42166, "monthThkSellAmount": 23, "monthGSellAmount": 1701, "sellMoney": 7993336.7, "tsellMoney": 4406727.99, "csellMoney": 3362139.58, "thksellMoney": 339.0, "gsellMoney": 224130.13, "monthSellMoney": 4.0932938466E8, "monthTSellMoney": 3.1128238171E8, "monthCSellMoney": 9.357895332E7, "monthThkSellMoney": 7797.0, "monthGSellMoney": 4460252.63, "productNum": 3072, "tproductNum": 1113, "cproductNum": 1927, "thkproductNum": 1, "gproductNum": 31, "shopNum": 726, "tshopNum": 180, "cshopNum": 533, "thkshopNum": 1, "gshopNum": 12 }, { "id": "50019780\u00012017-11-27 00:00:00\u0001", "date": "2017-11-27 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5909, "tsellAmount": 3900, "csellAmount": 1925, "thksellAmount": 2, "gsellAmount": 82, "monthSellAmount": 249619, "monthTSellAmount": 206212, "monthCSellAmount": 41632, "monthThkSellAmount": 26, "monthGSellAmount": 1749, "sellMoney": 8736025.24, "tsellMoney": 4591435.98, "csellMoney": 3936109.19, "thksellMoney": 678.0, "gsellMoney": 207802.07, "monthSellMoney": 4.0946112523E8, "monthTSellMoney": 3.1144824269E8, "monthCSellMoney": 9.348598891E7, "monthThkSellMoney": 8814.0, "monthGSellMoney": 4518079.63, "productNum": 3080, "tproductNum": 1119, "cproductNum": 1929, "thkproductNum": 1, "gproductNum": 31, "shopNum": 721, "tshopNum": 180, "cshopNum": 528, "thkshopNum": 1, "gshopNum": 12 }, { "id": "50019780\u00012017-11-28 00:00:00\u0001", "date": "2017-11-28 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 6302, "tsellAmount": 4534, "csellAmount": 1661, "thksellAmount": 1, "gsellAmount": 106, "monthSellAmount": 249599, "monthTSellAmount": 206532, "monthCSellAmount": 41223, "monthThkSellAmount": 26, "monthGSellAmount": 1818, "sellMoney": 8360673.47, "tsellMoney": 4645942.0, "csellMoney": 3448004.33, "thksellMoney": 339.0, "gsellMoney": 266388.14, "monthSellMoney": 4.0913565028E8, "monthTSellMoney": 3.1154120268E8, "monthCSellMoney": 9.289489397E7, "monthThkSellMoney": 8814.0, "monthGSellMoney": 4690739.63, "productNum": 3064, "tproductNum": 1120, "cproductNum": 1914, "thkproductNum": 1, "gproductNum": 29, "shopNum": 716, "tshopNum": 180, "cshopNum": 524, "thkshopNum": 1, "gshopNum": 11 }, { "id": "50019780\u00012017-11-29 00:00:00\u0001", "date": "2017-11-29 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5925, "tsellAmount": 4078, "csellAmount": 1759, "thksellAmount": 0, "gsellAmount": 88, "monthSellAmount": 249682, "monthTSellAmount": 207020, "monthCSellAmount": 40775, "monthThkSellAmount": 25, "monthGSellAmount": 1862, "sellMoney": 8770488.67, "tsellMoney": 4948707.03, "csellMoney": 3599229.64, "thksellMoney": 0.0, "gsellMoney": 222552.0, "monthSellMoney": 4.0929204432E8, "monthTSellMoney": 3.119758647E8, "monthCSellMoney": 9.250327312E7, "monthThkSellMoney": 9200.0, "monthGSellMoney": 4803706.5, "productNum": 3069, "tproductNum": 1113, "cproductNum": 1926, "thkproductNum": 1, "gproductNum": 29, "shopNum": 716, "tshopNum": 181, "cshopNum": 523, "thkshopNum": 1, "gshopNum": 11 }, { "id": "50019780\u00012017-11-30 00:00:00\u0001", "date": "2017-11-30 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5990, "tsellAmount": 4256, "csellAmount": 1653, "thksellAmount": 0, "gsellAmount": 81, "monthSellAmount": 250746, "monthTSellAmount": 207632, "monthCSellAmount": 41186, "monthThkSellAmount": 23, "monthGSellAmount": 1905, "sellMoney": 8269972.84, "tsellMoney": 4695810.01, "csellMoney": 3367242.76, "thksellMoney": 0.0, "gsellMoney": 206920.07, "monthSellMoney": 4.0996300569E8, "monthTSellMoney": 3.1210557672E8, "monthCSellMoney": 9.295235647E7, "monthThkSellMoney": 8464.0, "monthGSellMoney": 4896608.5, "productNum": 3063, "tproductNum": 1104, "cproductNum": 1929, "thkproductNum": 1, "gproductNum": 29, "shopNum": 712, "tshopNum": 179, "cshopNum": 521, "thkshopNum": 1, "gshopNum": 11 }, { "id": "50019780\u00012017-12-01 00:00:00\u0001", "date": "2017-12-01 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5934, "tsellAmount": 4002, "csellAmount": 1852, "thksellAmount": 3, "gsellAmount": 77, "monthSellAmount": 252304, "monthTSellAmount": 208554, "monthCSellAmount": 41753, "monthThkSellAmount": 22, "monthGSellAmount": 1975, "sellMoney": 8271745.73, "tsellMoney": 4279977.99, "csellMoney": 3794843.68, "thksellMoney": 1104.0, "gsellMoney": 195820.06, "monthSellMoney": 4.10505777E8, "monthTSellMoney": 3.124265247E8, "monthCSellMoney": 9.303085879E7, "monthThkSellMoney": 8096.0, "monthGSellMoney": 5040297.51, "productNum": 3057, "tproductNum": 1097, "cproductNum": 1929, "thkproductNum": 1, "gproductNum": 30, "shopNum": 713, "tshopNum": 180, "cshopNum": 520, "thkshopNum": 1, "gshopNum": 12 }, { "id": "50019780\u00012017-12-02 00:00:00\u0001", "date": "2017-12-02 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 6793, "tsellAmount": 4545, "csellAmount": 2146, "thksellAmount": 0, "gsellAmount": 102, "monthSellAmount": 253301, "monthTSellAmount": 209364, "monthCSellAmount": 41863, "monthThkSellAmount": 18, "monthGSellAmount": 2056, "sellMoney": 8606766.6, "tsellMoney": 4438886.99, "csellMoney": 3919624.54, "thksellMoney": 0.0, "gsellMoney": 248255.07, "monthSellMoney": 4.1102085035E8, "monthTSellMoney": 3.127156837E8, "monthCSellMoney": 9.306585514E7, "monthThkSellMoney": 6624.0, "monthGSellMoney": 5232687.51, "productNum": 3038, "tproductNum": 1090, "cproductNum": 1917, "thkproductNum": 1, "gproductNum": 30, "shopNum": 711, "tshopNum": 178, "cshopNum": 520, "thkshopNum": 1, "gshopNum": 12 }, { "id": "50019780\u00012017-12-03 00:00:00\u0001", "date": "2017-12-03 00:00:00", "categoryId": "50019780", "categoryName": null, "categoryLevel": 2, "brandName": "", "sellAmount": 5703, "tsellAmount": 4026, "csellAmount": 1574, "thksellAmount": 0, "gsellAmount": 103, "monthSellAmount": 254425, "monthTSellAmount": 210365, "monthCSellAmount": 41924, "monthThkSellAmount": 15, "monthGSellAmount": 2121, "sellMoney": 7868591.29, "tsellMoney": 4316238.0, "csellMoney": 3308763.23, "thksellMoney": 0.0, "gsellMoney": 243590.06, "monthSellMoney": 4.1179106436E8, "monthTSellMoney": 3.131679927E8, "monthCSellMoney": 9.326285549E7, "monthThkSellMoney": 5520.0, "monthGSellMoney": 5354696.17, "productNum": 3028, "tproductNum": 1090, "cproductNum": 1908, "thkproductNum": 1, "gproductNum": 29, "shopNum": 708, "tshopNum": 178, "cshopNum": 517, "thkshopNum": 1, "gshopNum": 12 }]
    };

    // console.log(res);

    let data = res.data;

    this.sellResulet = this.util.getSellAllResult(this.sellResulet, res.data);
    setTimeout(() => {
      this.vm.loading = false;

      this.vm.data = data;
    }, 1000);



  }



}
